import { useCallback } from 'react';
import { useConfig } from './D8dConfigProvider.tsx';
import { pushStateAndTrigger } from '../utils/fun.ts';
// import { useNavigate as useRemixNavigate ,useSearchParams} from '@remix-run/react';

export const useNavigate = () => {
  const { useSpaRouter } = useConfig();
  // const remixNavigate = useRemixNavigate();

  const navigate = useCallback((path: string) => {
    if (useSpaRouter) {
      pushStateAndTrigger(path);
    } else {
      // 使用 Remix 导航
      // remixNavigate(path);
    }
  }, [useSpaRouter]);

  return navigate;
}; 